﻿<UserControl
    x:Class="SampleApp.Controls.ConnectionControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:converters="using:SampleApp.Converters"
    xmlns:system="using:System"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">

	<UserControl.Resources>
		<converters:IndexToVisibilityConverter x:Name="IntToVis" />
	</UserControl.Resources>
	<Grid>
		<Rectangle Fill="#ccc" Opacity=".85" />
		<Border Padding="15" Background="#111"  VerticalAlignment="Top">
			<StackPanel>
				<TextBlock
					Foreground="White"
					FontSize="32"
					Margin="0, 0, 0, 10">
					<Run Text="Connection Type"/>
				</TextBlock>

				<ComboBox
					Margin="0, 0, 0, 20" 
					x:Name="ConnectionTypeStyle"
					SelectedIndex="0">
					<ComboBoxItem>usb</ComboBoxItem>
					<ComboBoxItem>bluetooth</ComboBoxItem>
					<ComboBoxItem>wifi</ComboBoxItem>
				</ComboBox>

				<StackPanel 
					Visibility="{Binding SelectedIndex,
					ConverterParameter=2, 
					Converter={StaticResource IntToVis},
					ElementName=ConnectionTypeStyle}">
					<Grid>
						<TextBlock 
							HorizontalAlignment="Left">
							<Run Text="IP address"/>
						</TextBlock>
					</Grid>
					<TextBox x:Name="IpAddress" Text="192.168.1.10" />
				</StackPanel>

				<Button 
					HorizontalAlignment="Right"
					Content="connect" 
					Click="RoundButton_Click" />
			</StackPanel>
		</Border>
	</Grid>
</UserControl>
